package com.ruoyi.dgdData.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.dgdData.domain.plat.DataDgdMzxx;
import com.ruoyi.dgdData.service.IDataDgdMzxxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单轨吊满载向下制动距离测试Controller
 * 
 * @author ruoyi
 * @date 2023-12-28
 */
@RestController
@RequestMapping("/dgd/mzxx")
@Api(value="单轨吊测试",tags = "单轨吊满载向下制动距离测试接口")
public class DataDgdMzxxController extends BaseController
{
    @Autowired
    private IDataDgdMzxxService dataDgdMzxxService;

    /**
     * 查询单轨吊满载向下制动距离测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:list')")
    @GetMapping("/list")
    @ApiOperation(value="查询单轨吊满载向下制动距离测试列表")
    public TableDataInfo list(DataDgdMzxx dataDgdMzxx)
    {
        startPage();
        List<DataDgdMzxx> list = dataDgdMzxxService.selectDataDgdMzxxList(dataDgdMzxx);
        return getDataTable(list);
    }

    /**
     * 导出单轨吊满载向下制动距离测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:export')")
    @Log(title = "单轨吊满载向下制动距离测试", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataDgdMzxx dataDgdMzxx)
    {
        List<DataDgdMzxx> list = dataDgdMzxxService.selectDataDgdMzxxList(dataDgdMzxx);
        ExcelUtil<DataDgdMzxx> util = new ExcelUtil<DataDgdMzxx>(DataDgdMzxx.class);
        util.exportExcel(response, list, "单轨吊满载向下制动距离测试数据");
    }

    /**
     * 获取单轨吊满载向下制动距离测试详细信息
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:query')")
    @GetMapping(value = "/{mzxxId}")
    public AjaxResult getInfo(@PathVariable("mzxxId") Long mzxxId)
    {
        return success(dataDgdMzxxService.selectDataDgdMzxxByMzxxId(mzxxId));
    }

    /**
     * 新增单轨吊满载向下制动距离测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:add')")
    @Log(title = "单轨吊满载向下制动距离测试", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataDgdMzxx dataDgdMzxx)
    {
        return toAjax(dataDgdMzxxService.insertDataDgdMzxx(dataDgdMzxx));
    }

    /**
     * 修改单轨吊满载向下制动距离测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:edit')")
    @Log(title = "单轨吊满载向下制动距离测试", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataDgdMzxx dataDgdMzxx)
    {
        return toAjax(dataDgdMzxxService.updateDataDgdMzxx(dataDgdMzxx));
    }

    /**
     * 修改单轨吊满载向下制动距离测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:edit')")
    @Log(title = "单轨吊满载向下制动距离测试", businessType = BusinessType.UPDATE)
    @PutMapping("/editMzxx/{mzxxId}")
    @ApiOperation(value="修改单轨吊满载向下制动距离测试")
    public AjaxResult editMzxx(@PathVariable Long mzxxId)
    {
        return toAjax(dataDgdMzxxService.updateDataDgdMzxxByMzxxId(mzxxId));
    }

    /**
     * 删除单轨吊满载向下制动距离测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:mzxx:remove')")
    @Log(title = "单轨吊满载向下制动距离测试", businessType = BusinessType.DELETE)
	@DeleteMapping("/{mzxxIds}")
    public AjaxResult remove(@PathVariable Long[] mzxxIds)
    {
        return toAjax(dataDgdMzxxService.deleteDataDgdMzxxByMzxxIds(mzxxIds));
    }
}
